#pragma once

#define write32(__addr,__value ) (*(volatile uint32_t *)(__addr) = __value)
#define write8(__addr,__value ) (*(volatile uint8_t *)(__addr) = __value)
#define read32(__addr)           (*(volatile uint32_t *)(__addr))
#define read16(__addr)           (*(volatile uint16_t *)(__addr))
#define read8(__addr)           (*(volatile uint8_t *)(__addr))
#define __IO  volatile

#ifdef __ASSEMBLER__
#define CONS(NUM, TYPE)NUM
#else
#define CONS(NUM, TYPE)NUM##TYPE
#endif /* __ASSEMBLER__ */

#define PRIM_HART			0

#define CLINT_ADDR			CONS(0x02000000, UL)
#define CLINT_MSIP			CONS(0x0000, UL)
#define CLINT_MTIMECMP		CONS(0x4000, UL)
#define CLINT_MTIME			CONS(0xbff8, UL)

#define NS16550_ADDR		CONS(0x10000000, UL)